home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.02 Feb 90 / HyperBASIC / Sieve Benchmark.bas < prev   
Encoding:
BASIC Source File  |  1989-12-18  |  439 b   |  28 lines  |  [TEXT/HBAS]

  1. xCMD SieveofErastothenes
  2. DEFINT a-s
  3. DEFDBL t
  4. DIM Flags(8191)
  5. time1=_TickCount
  6. '10 Iterations
  7. FOR m=1 TO 10
  8. Count=0
  9. FOR i=1 to 8191
  10. Flags(i)=1
  11. NEXT i
  12. FOR i=1 to 8191
  13. IF Flags(i)=0 THEN GOTO 170
  14. Prime=i+i+3
  15. k=i+Prime
  16. 120 IF k<= 8190 THEN 
  17.           Flags(k)=0
  18.           k=k+Prime
  19.           GOTO 120
  20. END IF
  21. Count=Count+1
  22. 170 NEXT i
  23. NEXT m
  24. time2=_TickCount
  25. Totaltime=(time2-time1)/60
  26. Totaltime$=str$(Totaltime)
  27. SETFIELDBYNUM 1,8,Totaltime$
  28. END